package com.zang.server.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zang.server.pojo.OperationLog;
import com.zang.server.mapper.OperationLogMapper;
import com.zang.server.pojo.RespPageBean;
import com.zang.server.service.IOperationLogService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author zang
 * @since 2022-02-24
 */
@Service
public class OperationLogServiceImpl extends ServiceImpl<OperationLogMapper, OperationLog> implements IOperationLogService {

    @Autowired
    private OperationLogMapper operationLogMapper;

    @Override
    public RespPageBean getPage(Integer currentPage, Integer size, OperationLog operationLog) {
        Page<OperationLog> page = new Page<>(currentPage,size);
        IPage<OperationLog> op =  operationLogMapper.getListOpterationLog(page,operationLog);
        return new RespPageBean(op.getTotal(),op.getRecords());
    }
}
